@extends('admin.main')
@section('content')
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">后台设置</strong>
                    /
                    <strong class="am-text-primary am-text-lg">管理员</strong>
                    {{--/ <small>管理员</small>--}}
                </div>
            </div>
            <hr>
            {{--@include('admin.layouts.menu')--}}
            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                            <a href="{{ADMIN_DOMAIN}}/basic/auth/adminlog">
                                <button type="button" class="am-btn am-btn-default">
                                    <span class="am-icon-file"></span> 登陆记录
                                </button>
                            </a>
                            <a href="{{$prefix_url}}/create">
                                <button type="button" class="am-btn am-btn-default">
                                    <span class="am-icon-plus"></span> 新增
                                </button>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="am-g">
                <div class="am-u-sm-12">
                    <table class="am-table am-table-striped am-table-hover table-main">
                        <thead>
                        <tr>
                            <th class="table-check"><input type="checkbox" /></th>
                            <th class="table-id">ID</th>
                            <th class="table-title">管理员</th>
                            <th class="table-type">密码</th>
                            <th class="table-author am-hide-sm-only">是否删除</th>
                            {{--<th class="table-date am-hide-sm-only">创建日期</th>--}}
                            <th class="table-set">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($datas as $data)
                        <tr>
                            <td><input type="checkbox"/></td>
                            <td>{{$data->id}}</td>
                            <td><a href="javascript:;">{{$data->name}}</a></td>
                            <td>****</td>
                            <td class="am-hide-sm-only">
                                @if($data->del)
                                    <span style="color:red;">已删除</span>
                                @else 使用中
                                @endif
                            </td>
                            {{--<td class="am-hide-sm-only">{{$data->createTime()}}</td>--}}
                            <td>
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs">
                                        <a href="{{$prefix_url}}/{{$data->id}}/edit">
                                            <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                                <span class="am-icon-pencil-square-o"></span>
                                                编辑
                                            </button>
                                        </a>
                                        <a href="javascript:;" onclick="adminGetPwd({{$data->id}})">
                                            <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                                {{--<span class="am-icon-pencil-square-o"></span>--}}
                                                密码更新
                                            </button>
                                        </a>
                                        <a href="javascript:;" onclick="adminSetPwd2({{$data->id}})">
                                            <button class="am-btn am-btn-default
                                                am-btn-xs am-text-secondary">
                                                密码重置
                                            </button>
                                        </a>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        @endforeach
                        </tbody>
                    </table>
                    {{--@include('admin.layouts.page')--}}
                    <hr><p style="color:#808080;">注意：初始密码默认12345。</p>
                </div>
            </div>
        </div>
    </div>

    <style>
        #my-pwd input { margin:5px auto;padding:5px;
            width:90%;border:1px solid #eeeeee; }
    </style>

    <div class="am-modal am-modal-alert" tabindex="-1" id="my-pwd">
        <div class="am-modal-dialog">
            <div class="am-modal-hd">密码更新</div>
            <div class="am-modal-bd">
                <input type="hidden" name="_token" value="{{csrf_token()}}">
                <input type="hidden" id="id">
                <input type="text" id="pwdOld" placeholder="老密码">
                <input type="text" id="pwdNew" placeholder="新密码">
            </div>
            <div class="am-modal-footer">
                <span class="am-modal-btn">取消</span>
                <span class="am-modal-btn" onclick="adminSetPwd()">确定</span>
            </div>
        </div>
    </div>
@stop